class Property < ActiveRecord::Base
  validates :key,
    :value,
    :presence => true
  validates :key,
    :uniqueness => true

  def self.dns
    #asoft.oicp.net:3000
    'http://dev.mytusi.com:3000'
  end

  def self.authorize_url
    '/oauth/2.0/authorize'
  end

  def self.token_url
    '/oauth/2.0/token'
  end

  def self.site
    'https://openapi.baidu.com'
  end

  def self.baidu_id
    where(:key => "baidu_id").limit(1).each do |obj|
      return obj.value
    end
  end

  def self.baidu_api_key
    where(:key => "baidu_api_key").limit(1).each do |obj|
      return obj.value
    end
  end

  def self.baidu_secret_key
    where(:key => "baidu_secret_key").limit(1).each do |obj|
      return obj.value
    end
  end
end
